import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/4/3 21:28
 */

public class Solution {
    public int[] sortArray(int[] nums) {
        Quicksort(nums, 0, nums.length - 1);
        return nums;
    }

    private void Quicksort(int[] nums, int l, int r) {
        if (l >= r) return;//作为递归结束的条件

        //数组分三块
        int key = nums[new Random().nextInt(r - l + 1) + l];
        int left = l - 1, right = r + 1, i = l;
        while (i < right) {
            if (nums[i] < key) swap(nums, ++left, i++);
            else if (nums[i] == key) i++;
            else if (nums[i] > key) swap(nums, --right, i);
        }
        Quicksort(nums, l, left);
        Quicksort(nums, right, r);
    }

    private void swap(int[] nums, int i, int j) {
        int tmp = nums[i];
        nums[i] = nums[j];
        nums[j] = tmp;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int len = in.nextInt();
            int[] nums = new int[len];
            for (int i = 0; i < len; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            int[] ret = solution.sortArray(nums);
            System.out.println(Arrays.toString(ret));
        }
    }
}